Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow MetricsReader to return point_ids for properties that are associated with multiple property name keys. #2

Merged

Conversation

alisonspencer
Copy link
Contributor

Allow MetricsReader._get_point_ids to return point_ids for device aliases that are associated with multiple property keys.

Issue: For some sites and devices, point_ids are associated with more than one property keys -- eg, both ReturnTemperature and ControlTemperature. When retrieving data for one of these keys, the current code compares the length of the two does the following:

properties to retrieve = ['ReturnTemperature', 'ControlTemperature']
values = [{key: 'ReturnTemperature', 'alias': 'evap_X_returnTemperature'}, {key: 'ControlTemperature', 'alias': 'evap_X_returnTemperature'}]

value_alias_list = ['evap_X_returnTemperature', 'evap_X_returnTemperature']
point_map = {'evap_X_returnTemperature': 'abcdefg-123456'}

The existing code compares len(value_alias_list) == len(point_map.keys())
Since the length of values.alias_list = 2 and the length of point_map.keys() = 1, the function throws an error and no point_id is returned for either property.

Comparing the lengths of the sets instead returns the correct point_id and allows data to be retrieved for both properties.

…f the sets of point_map keys and desired aliases, rather than the lengths of the raw lists. This allows a point_id to be retrieved when the desired property is associate with more than one key (eg, ReturnTemperature and ControlTemperature).
@raphael
Copy link
Contributor

raphael commented Feb 8, 2025

This is great, thank you!

@raphael raphael merged commit a262a19 into crossnokaye:main Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants